"use strict"

app.config(["$stateProvider", "$urlRouterProvider", "$locationProvider", routeFn]);

function routeFn($stateProvider, $urlRouterProvider, $locationProvider) {
	$urlRouterProvider.otherwise("/login");
	$stateProvider.state("login", {
			url: "/login",
			views: {
				"": {
					templateUrl: "login.html",
					controller: "loginController"
				}
			},
			resolve: {
				loadModule: ["$ocLazyLoad", function($ocLazyLoad) {
					return $ocLazyLoad.load([
					    'ui.bootstrap',
						'service.httpService',
						'service.validation',
						'ui.pagination',
						'ui.dialog'
					]);
				}],
				loadMyCtrl: ['$ocLazyLoad', 'loadModule', function($ocLazyLoad, loadModule) {
					return $ocLazyLoad.load({
						files: ['/js/main/loginController.js']
					});
				}]
			}
		})
		.state("main", {
			url: "/main",
			views: {
				"": {
					templateUrl: "main.html",
					//controller: "mainController"
				}
			},
			resolve: {
				loadModule: ["$ocLazyLoad", function($ocLazyLoad) {
					return $ocLazyLoad.load([
					    'ui.chart',
						'ui.bootstrap',
						'service.httpService',
						'service.validation',
						'service.authorService',
						'ui.pagination',
						'ui.dialog',
						'ui.tree'
					]);
				}],
				loadMyCtrl: ['$ocLazyLoad', 'loadModule', function($ocLazyLoad, loadModule) {
					return $ocLazyLoad.load({
						files: ['/js/main/mainController.js']
					});
				}]
			}
		})
		.state("mainPage", {
		        url: "/mainPage",
                views: {
                     "": {
                         templateUrl: "mainPage.html"
                     }
                 },
                 resolve: {
                     loadModule: ["$ocLazyLoad", function($ocLazyLoad) {
                         return $ocLazyLoad.load(['ui.chart',
                             'ui.bootstrap',
                             'service.httpService',
                             'service.validation',
                             'service.authorService',
                             'ui.pagination',
                             'ui.dialog',
                             'ui.tree'
                         ]);
                     }],
                     loadMyCtrl: ['$ocLazyLoad', 'loadModule', function($ocLazyLoad, loadModule) {
                         return $ocLazyLoad.load({
                             files: ['/js/main/accordionController.js']
                         });
                     }]
                 }
             })
        .state("mainPage.mq", {
                url: "/senders/mq",
                views: {
                    "": {
                        templateUrl: "senders/mq.html",
                        controller: "mqController"
                    }
                },
                resolve: {
                    loadMyCtrl: ['$ocLazyLoad', function($ocLazyLoad) {
                        return $ocLazyLoad.load(
                            ['/js/main/mqController.js']
                        );
                    }]
                }
            })
        .state("mainPage.socket", {
                url: "/senders/socket",
                views: {
                    "": {
                        templateUrl: "senders/socket.html",
                        controller: "socketController"
                    }
                },
                resolve: {
                    loadMyCtrl: ['$ocLazyLoad', 'loadModule', function($ocLazyLoad, loadModule) {
                        return $ocLazyLoad.load({
                            files: ['/js/main/socketController.js']
                        });
                    }]
                }
            })
        .state("mainPage.ws", {
                    url: "/senders/ws",
                    views: {
                        "": {
                            templateUrl: "senders/ws.html",
                            controller: "wsController"
                        }
                    },
                    resolve: {
                        loadMyCtrl: ['$ocLazyLoad', 'loadModule', function($ocLazyLoad, loadModule) {
                            return $ocLazyLoad.load({
                                files: ['/js/main/wsController.js']
                            });
                        }]
                    }
                })
        .state("mainPage.xxx001", {
                    url: "/senders/xxx001",
                    views: {
                        "": {
                            templateUrl: "senders/main.html",
                            //controller: "mainController"
                        }
                    },
                    resolve: {
                        loadMyCtrl: ['$ocLazyLoad', 'loadModule', function($ocLazyLoad, loadModule) {
                            return $ocLazyLoad.load({
                                files: ['/js/main/mainController.js']
                            });
                        }]
                    }
                })
        .state("mainPage.xxx002", {
                url: "/senders/xxx002",
                views: {
                    "": {
                        templateUrl: "senders/main.html",
                        //controller: "mainController"
                    }
                },
                resolve: {
                    loadMyCtrl: ['$ocLazyLoad', 'loadModule', function($ocLazyLoad, loadModule) {
                        return $ocLazyLoad.load({
                            files: ['/js/main/mainController.js']
                        });
                    }]
                }
            })
        .state("mainPage.mq_param", {
                url: "/senders/mq_param",
                views: {
                    "": {
                        templateUrl: "senders/mq_param.html",
                        controller: "mqParamController"
                    }
                },
                resolve: {
                    loadMyCtrl: ['$ocLazyLoad', 'loadModule', function($ocLazyLoad, loadModule) {
                        return $ocLazyLoad.load({
                            files: ['/js/main/mqParamController.js']
                        });
                    }]
                }
            })
         .state("mainPage.socket_param", {
             url: "/senders/socket_param",
             views: {
                 "": {
                     templateUrl: "senders/socket_param.html",
                     controller: "socketParamController"
                 }
             },
             resolve: {
                 loadMyCtrl: ['$ocLazyLoad', 'loadModule', function($ocLazyLoad, loadModule) {
                     return $ocLazyLoad.load({
                         files: ['/js/main/socketParamController.js']
                     });
                 }]
             }
         })
         .state("mainPage.ws_param", {
              url: "/senders/ws_param",
              views: {
                  "": {
                      templateUrl: "senders/ws_param.html",
                      controller: "wsParamController"
                  }
              },
              resolve: {
                  loadMyCtrl: ['$ocLazyLoad', 'loadModule', function($ocLazyLoad, loadModule) {
                      return $ocLazyLoad.load({
                          files: ['/js/main/wsParamController.js']
                      });
                  }]
              }
          })

         .state("mainPage.xxx003", {
           url: "/senders/xxx003",
           views: {
               "": {
                   templateUrl: "senders/main.html",
                   //controller: "mainController"
               }
           },
           resolve: {
               loadMyCtrl: ['$ocLazyLoad', 'loadModule', function($ocLazyLoad, loadModule) {
                   return $ocLazyLoad.load({
                       files: ['/js/main/mainController.js']
                   });
               }]
           }
       })

     ;





};